#include "PreCompile.hpp"
#include "StringBuilderTests.hpp"
#include "../StringBuilder.hpp"

namespace BuildNG
{
  void StringBuilderTests::test_string_builder()
  {
    StringBuilder<16> string_builder;
    string_builder.append("Lorem ");
    string_builder.append("ipsum ");
    string_builder.append("dolor ");
    string_builder.append("sit ");
    string_builder.append("amet, ");
    string_builder.append("");
    string_builder.append("consectetur ");

    assert(string_builder.to_ustring() == "Lorem ipsum dolor sit amet, consectetur ");
  }

  void StringBuilderTests::test_clear()
  {
    StringBuilder<16> string_builder;
    string_builder.append("Lorem ");
    string_builder.append("ipsum ");
    string_builder.append("dolor ");
    string_builder.append("sit ");
    string_builder.append("amet, ");
    string_builder.append("");
    string_builder.append("consectetur ");

    string_builder.clear();
    assert(string_builder.to_ustring() == "");

    string_builder.append("Blabla, ");
    string_builder.append("bladie ");
    string_builder.append("bla!");
    assert(string_builder.to_ustring() == "Blabla, bladie bla!");
  }

  void StringBuilderTests::test_pop_end()
  {
    StringBuilder<8> string_builder;
    string_builder.append("1234567890");
    string_builder.pop_end(3);
    assert(string_builder.to_ustring() == "1234567");

    string_builder.append("appended");
    assert(string_builder.to_ustring() == "1234567appended");
  }
}
